﻿using System;
using System.IO;
using System.Windows.Media;
using Styx.Common;
using Styx.CommonBot;

namespace HolySword.Helpers
{
    public static class LogManager
    {
        private static string _lastCombatmsg;
        private static string _lastDebugmsg;
        private static string _lastItemmsg;
        private static string _lastMovementmsg;

        public static string ApplicationPath
        {
            get { return Utilities.AssemblyDirectory; }
        }

        public static void MovementLog(string message, params object[] args)
        {
            if (message == _lastMovementmsg) return;
            Logging.Write(Colors.PowderBlue, "[MovementLog] " + message, args);
            _lastMovementmsg = message;
        }

        public static void InitLog(string message, params object[] args)
        {
            if (message == null) return;
            Logging.Write(Colors.Gainsboro, "  " + message, args);
        }

        public static void ItemLog(string message, params object[] args)
        {
            if (message == _lastItemmsg) return;
            Logging.Write(Colors.LawnGreen, "[ItemLog] " + message, args);
            _lastItemmsg = message;
        }

        public static void FailLog(string message, params object[] args)
        {
            if (message == null) return;
            Logging.Write(Colors.GreenYellow, "[FailLog] " + message, args);
        }

        public static void InfoLog(string message, params object[] args)
        {
            if (message == null) return;
            Logging.Write(Colors.CornflowerBlue, "[InfoLog] " + message, args);
        }

        public static void CombatLog(string message, params object[] args)
        {
            var gcd = SpellManager.GlobalCooldownLeft.Milliseconds;
            if (message == _lastCombatmsg) return;
            Logging.Write(Colors.Pink, string.Format("[CombatLog - GCD {0}ms] {1}",gcd, message), args);
            _lastCombatmsg = message;
        }

        public static void DebugLog(string message, params object[] args)
        {
            if (message == _lastDebugmsg) return;
            Logging.Write(Colors.DarkGoldenrod, "[DebugLog] " + message, args);
            _lastDebugmsg = message;
        }
    }
}